﻿package 最长递增子序列;

/**
 * Created by hest0 on 2017/4/17.
 */
public class 最长递增子序列 {
    public static void main(String[] args) {

    }

    public class AscentSequence {
        public int findLongest(int[] A, int n) {
            int[] dp = new int[n];
            dp[0] = 1;
            for (int i = 1; i < n; i++) {
                dp[i] = 1;
                for (int j = 0; j < i; j++) {
                    if (A[i] > A[j])
                        dp[i] = Math.max(dp[j] + 1, dp[i]);
                }
            }
            int maxLen = 0;
            for (int x : dp) {
                maxLen = Math.max(x, maxLen);
            }
            return maxLen;
        }
    }
}
